<!DOCTYPE HTML>
<html lang="zh">
<meta charset="utf-8">
<head>
    <link href="/aityWeb/static/favicon.ico" rel="stylesheet"/>
    <link href="/aityWeb/static/css/font-awesome.css" rel="stylesheet"/>

    <style type="text/css">
        .nav > li:hover .dropdown-menu {display: block;}
    </style>

    <link href="/aityWeb/static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/aityWeb/static/css/font-awesome.css" rel="stylesheet"/>

    <link href="/aityWeb/static/css/animate.css" rel="stylesheet"/>
    <link href="/aityWeb/static/css/style.css" rel="stylesheet"/>
    <link href="/aityWeb/static/css/checkbox.css" rel="stylesheet"/>
    <link href="/aityWeb/static/ajax/libs/select/select2.css" rel="stylesheet"/>
    <link href="/aityWeb/static/galaxy/css/ry-ui.css" rel="stylesheet"/>


</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-info" style="padding-top: 10px;">
            <ul class="breadcrumb" style="font-size: 16px;background-color: #f3f3f3;padding: 5px 10px;color: #337ab7;">
                <li><i class="fa fa-home" aria-hidden="true"></i>&nbsp;&nbsp;<a href="#">场馆管理</a></li>
                <li><i class="fa fa-home" aria-hidden="true"></i>&nbsp;&nbsp;<a href="#">场馆详情</a></li>
                <li><i class="fa fa-home" aria-hidden="true"></i>&nbsp;&nbsp;<a href="#">运动类型</a></li>
            </ul>
            <div class="col-sm-8 " style="padding-top: 10px;height: 100%">

                <form class="form-horizontal" role="form" style="margin-top: 20px;">

                    <h6>运动类型（多选）</h6>
                    <div id ="ydlx" class="form-group">
                        

                    </div>

                    <div class="form-group">

                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="button" class="btn btn-success" onclick="save();">上传</button>

                            <button type="button" class="btn btn-default" onclick="history.back();" style="margin-left: 10px;">返回</button>
                        </div>

                    </div>
                </form>
            </div>

        </div>
    </div>
</div>

<script src="/aityWeb/static/js/jquery.min.js"></script>
<script src="/aityWeb/static/js/bootstrap.min.js"></script>


<!-- jquery-validate 表单验证插件 -->
<script src="/aityWeb/static/ajax/libs/validate/jquery.validate.min.js"></script>
<script src="/aityWeb/static/ajax/libs/validate/messages_zh.min.js"></script>
<script src="/aityWeb/static/ajax/libs/validate/jquery.validate.extend.js"></script>
<!-- jquery-validate 表单树插件 -->
<script src="/aityWeb/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>

<!-- 遮罩层 -->
<script src="/aityWeb/static/ajax/libs/blockUI/jquery.blockUI.js"></script>
<script src="/aityWeb/static/ajax/libs/layer/layer.min.js"></script>
<script src="/aityWeb/static/ajax/libs/layui/layui.js"></script>
<script src="/aityWeb/static/galaxy/js/common.js?v=2.3.0"></script>
<script src="/aityWeb/static/galaxy/js/ry-ui.js?v=2.3.0"></script>

<script src="/aityWeb/static/js/app/net.js"></script>
<script src="/aityWeb/static/js/app/app.js"></script>
<script src="/aityWeb/static/js/lib/MD5.js"></script>

<script type="text/javascript">

    $(function() {
		gopage();
    });
    
    function gopage(){
    	//查询参数准备
        var info = {
            type:"type",
            token:"1234567890"
        };
        //接口调用
        doPost("shop/shopcatelist",info,function(data){
            var list = data.data;
            var appendHtml = "";
            var ydName = "";
            $.each(list,function(index,row){
            	ydName = "yd"+row.id;
		    appendHtml +=" <div class='col-sm-2' class='checkbox' style='padding-bottom: 10px'>"+
                            "<input type='checkbox'name='ydName' id='"+ydName+"' value='"+row.id+"' typeName ='"+row.catename+"'> "+row.catename+"</div>";
		  });
            $("#ydlx").html(appendHtml);
            looding();
        });
    }

        function looding(){
        var re = GetRequest();
        var shop = re['shop'];
        //查询参数准备
        var info = {
            page: 1,
            rows: 100,
            type:"type",
            shopid:parseInt(shop)
        };
        //接口调用
        doPost("shop/selectShopGoodsType",info,function(data){
        	var list = data.data;
            $.each(list,function(index,row){
            	$("#yd"+row.cate).attr("checked",true);
        	});
        });
    }
     
    function save(){
    	var re = GetRequest();
        var shop = re['shop'];
    	var ydList = [];
    	
        $("input[name='ydName']:checked").each(function(i){//把所有被选中的复选框的值存入数组
            var ydData = {};//定义一个空数组 
            ydData.ydid = parseInt($(this).val());
            ydData.ydname = $(this).attr("typeName");
            ydList.push(ydData);

        });

    	 //参数准备
        var info = {
        	ydList:ydList,
            type:"addAll",
            shopid:parseInt(shop)
        };
    	 doPost("shop/addOrUpdateShopGoodsType",info,function(data){
        	gopage();
        });
    }
        
    function clubSave(){
        $.loadInner.updateUrl("/aityWeb/view/clubManger/list.html");
    }

</script>
</body>
</html>

